Microcontrollers control a wide variety of devices. For example, in a computer storage system having multiple disk drives and multiple power supplies, an Environmental Monitoring Unit (EMU) is controlled by a microcontroller. The EMU performs a variety of tasks including monitoring power supply voltage and currents, fan speeds, temperature of the storage system enclosure, and the status of the various disk drives in the storage system. The EMU reports to a host system, and may perform low level control functions such as turning up fan speed to enhance cooling.
Typically, the microcontroller in the EMU may be a member of the Intel 8051 family of microcontrollers. The 8051 microcontroller has two memory regions which are 64 Kbytes of program space and 64 Kbytes of data space. The two memory regions are separately addressable. The program space, also known as code space, is not writeable and may only be accessed by instruction fetches. The data space is read/writeable but programs may not be executed from this memory region.
A rewriteable flash memory is associated with the microcontroller. The flash memory is used to store application code. To program the flash memory, the microcontroller needs data addressable read/write/erase access to the flash memory, i.e. the flash memory needs to be mapped into the data space of the microcontroller. This makes the flash memory inaccessible for program execution. To execute programs from the flash memory, the microcontroller needs program addressable read access to the flash memory, i.e. the flash memory must be mapped into the program space of the microcontroller. This makes the flash memory unwriteable during programming. In addition, the whole of the flash memory becomes inaccessible for reading or writing when any part of it is being erased or programmed.
From time to time, new application code is needed in order to upgrade the storage system or to adapt the system to changing requirements, or to replace application code which has become corrupt. A method of reprogramming, particularly in the case of EPROMs, involves removing the microcontroller having the old application code and replacing it with another having new code. It is preferable to have a method of receiving code into the microcontroller without removing the microcontroller from the storage system. Ideally, continuous operation of the storage system would be maintained while new application code is programmed into the storage system. The limitations of the flash memory, however, prevent continuous operation of the storage system because it is not possible to simultaneously read from and write into the flash memory.
In the process of reprogramming, there is a risk of replacing the current application code with "bad" code. This may occur when corrupt code is received or when the reprogramming process is interrupted for some reason, such as a power outage, and the resulting code is incomplete. In systems where the boot code is part of the application code or where the boot code is stored in the same memory as the application code, bad code results in significant system down time while the system is reprogrammed with new boot code.
It is desirable to integrate a programmable memory into an arrangement having a microcontroller having a write-protected memory, such as an 8051 chip, so that application code may be received while a basic code, i.e. a boot code, is retained from which the system may continue to operate.